package com.dhcc.DRGsHosp.facade.impl.assembler;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.dhcc.DRGsHosp.core.domain.DailyRecord;
import com.dhcc.DRGsHosp.facade.dto.DailyRecordDTO;

public class DailyRecordAssembler {
	
	public static DailyRecordDTO  toDTO(DailyRecord  dailyRecord){
		if (dailyRecord == null) {
			return null;
		}
    	DailyRecordDTO result  = new DailyRecordDTO();
	    	result.setDrEpisodeid (dailyRecord.getDr_episode_id());
     	    	result.setDrMrno (dailyRecord.getDr_mr_no());
     	    	result.setDrPatientname (dailyRecord.getDr_patient_name());
     	    	result.setDrIndate (dailyRecord.getDr_in_date());
     	    	result.setDrOutdate (dailyRecord.getDr_out_date());
     	    	result.setDrPatienttype (dailyRecord.getDr_patient_type());
     	    	result.setDrIndep (dailyRecord.getDr_in_dep());
     	    	result.setDrOutdep (dailyRecord.getDr_out_dep());
     	    	result.setDrDrugcost (dailyRecord.getDr_drug_cost());
     	    	result.setDrNodrugcost (dailyRecord.getDr_nodrug_cost());
     	    	result.setDrTotalcost (dailyRecord.getDr_total_cost());
     	    	result.setDrIsabnormal (dailyRecord.getDr_is_abnormal());
     	    	result.setDrInhisdep (dailyRecord.getDr_in_hisdep());
     	    	result.setDrOuthisdep (dailyRecord.getDr_out_hisdep());
     	    return result;
	 }
	
	public static List<DailyRecordDTO>  toDTOs(Collection<DailyRecord>  dailyRecords){
		if (dailyRecords == null) {
			return null;
		}
		List<DailyRecordDTO> results = new ArrayList<DailyRecordDTO>();
		for (DailyRecord each : dailyRecords) {
			results.add(toDTO(each));
		}
		return results;
	}
	
	 public static DailyRecord  toEntity(DailyRecordDTO  dailyRecordDTO){
	 	if (dailyRecordDTO == null) {
			return null;
		}
	 	DailyRecord result  = new DailyRecord();
        result.setDr_episode_id (dailyRecordDTO.getDrEpisodeid());
         result.setDr_mr_no (dailyRecordDTO.getDrMrno());
         result.setDr_patient_name (dailyRecordDTO.getDrPatientname());
         result.setDr_in_date (dailyRecordDTO.getDrIndate());
         result.setDr_out_date (dailyRecordDTO.getDrOutdate());
         result.setDr_patient_type (dailyRecordDTO.getDrPatienttype());
         result.setDr_in_dep (dailyRecordDTO.getDrIndep());
         result.setDr_out_dep (dailyRecordDTO.getDrOutdep());
         result.setDr_drug_cost (dailyRecordDTO.getDrDrugcost());
         result.setDr_nodrug_cost (dailyRecordDTO.getDrNodrugcost());
         result.setDr_total_cost (dailyRecordDTO.getDrTotalcost());
         result.setDr_is_abnormal (dailyRecordDTO.getDrIsabnormal());
         result.setDr_in_hisdep (dailyRecordDTO.getDrInhisdep());
         result.setDr_out_hisdep (dailyRecordDTO.getDrOuthisdep());
 	  	return result;
	 }
	
	public static List<DailyRecord> toEntities(Collection<DailyRecordDTO> dailyRecordDTOs) {
		if (dailyRecordDTOs == null) {
			return null;
		}
		
		List<DailyRecord> results = new ArrayList<DailyRecord>();
		for (DailyRecordDTO each : dailyRecordDTOs) {
			results.add(toEntity(each));
		}
		return results;
	}
}
